package base.day19.array;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;

public class CollectionStudent {
    public static void main(String[] args) {
        Collection<Student> list=new ArrayList<>();
        Student stu=new Student("张三",19);
        Student stu1=new Student("李四",20);
        list.add(stu);
        list.add(stu1);

        Iterator<Student> it=list.iterator();
        while (it.hasNext()){
            System.out.println(it.next());
        }
        for (Student student : list) {
            System.out.println(student);
        }

    }
}
